﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manage_UpdateClass : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            Response.Write("<script>alert('请先登录!');window.location.href='../Login.aspx'</script>");
        }
        else
        {
            string Classid = Request["Classid"].ToString();
            ArrayList al = new Sqlselete().SelectClassInfo(Classid);
            for (int i = 0; i < al.Count; i++)
            {
                this.TextBox1.Text = al[0].ToString();
                this.TextBox2.Text = al[1].ToString();
                this.TextBox3.Text =al[2].ToString();
                this.TextBox4.Text = al[3].ToString();
              
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

       
            string Classid = this.TextBox1.Text.Trim();
            string EntranceTime = this.TextBox2.Text.Trim();
            int ManCount = Convert.ToInt32(this.TextBox3.Text.Trim());
            string TeacherName = this.TextBox4.Text.Trim();
            string Grade = this.DropDownList1.SelectedItem.Text;
            string State = this.DropDownList2.SelectedItem.Text;
            string UserName = Session["UserName"].ToString();
            string  WorkInfo="修改了"+Classid+"班资料";
            SqlUpdate su = new SqlUpdate();
             su.UpdateClassInfo(Classid, EntranceTime, ManCount, TeacherName, Grade, State);
            SqlInsert si = new SqlInsert();
            si.InsertWorkLog(UserName,DateTime.Now.ToString(),WorkInfo);
            Response.Write("<script>alert('修改成功！！');window.close();</script>");
        
    }
}
